
public class Date {
    public int year;//年
    public int month;//月
    public int day;//日

    /*String name;

    boolean flg;
    char c;*/

    public Date() {
       /* this.year = 2008;
        this.month = 8;
        this.day = 8;*/
        this(2008,8,8);
        System.out.println("执行了不带参数的构造方法....");
    }/**/

    public Date(int year,int month,int day) {
        this.year = year;
        this.month = month;
        this.day = day;
        System.out.println("执行了带有三个参数的构造方法......");
    }

    //局部变量优先使用   谁调用当前这个方法 谁就是this
    public void setDate(int year,int month,int day) {
        this.year = year;
        this.month = month;
        this.day = day;
    }
    // 我们建议 习惯使用this
    public void printDate() {
        System.out.println("年："+this.year+" 月："+this.month+" 日："+this.day);
        //this.haha();
    }
    public  void haha() {
        System.out.println("hahah!");
    }

    public static void main(String[] args) {
        //构造方法的调用 是发生在实例化对象的时候
        Date date = new Date();

        //Date date2 = new Date(2008,9,9);







       /*  System.out.println(date.year);
        System.out.println(date.month);
        System.out.println(date.day);

       System.out.println(date.name);
        System.out.println(date.flg);
        System.out.println(date.c);
*/
       /* int a;
        System.out.println(a);
        */

     /*   date.setDate(1945,9,1);
        date.printDate();

        Date date2 = new Date();
        date2.setDate(1949,10,1);
        date2.printDate();*/
    }
}